<template>
    <div class="div-wrapper new-detail-wrapper">
        <div class="container">
            <div class="title">
                {{title}}
                <span>{{time}}</span>
            </div>
            <div class="content ql-editor" v-html="content">
                {{content}}
            </div>
        </div>
    </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import $api from '../../api';
import { Loading , Notification} from 'element-ui';

@Component
export default class Papers extends Vue{
    private title: string = '';
    private content: string = '';
    private time: string = '';

    private mounted() {
        const params = this.$route.params;
        let item: any = params.item || {};
        if(!item.id){
            item = JSON.parse(localStorage.getItem('new-datail-cache') as any) || {};
        }

        if(!item.id){
            this.$router.push("/New");
        } else {
            this.title = item.title;
            this.content = item.content;
            this.time = item.time;
        }
    }
    private updated() {
        // console.log(this.$route.params);
    }

    private destroyed(){
        if(localStorage.getItem('new-datail-cache')){
            localStorage.removeItem('new-datail-cache');
        }
    }
}
</script>
<style lang="scss" scoped>
.new-detail-wrapper{
    .container .title{
        border: none;
        display: block;
        text-align: center;
        span{
            display: block;
            font-size: 14px;
        }
    }
}
</style>